package pl.pkolodziej.platform.dao.pooling;

import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;

import pl.pkolodziej.platform.vo.news.News;
import pl.pkolodziej.platform.vo.pooling.Pooling;
import pl.pkolodziej.platform.vo.user.User;
import pl.pkolodziej.platform.vo.user.UserInfo;

@Repository
public class PoolingDAOImpl implements PoolingDAO {
	
	@Autowired
	SessionFactory sessionFactory;
	
	@Autowired
	HibernateTemplate hibernateTemplate;
	
	public void save(Pooling pooling) {
		sessionFactory.getCurrentSession().save(pooling);
	}
	
	public int getUserPooling(User user){
		int p = hibernateTemplate.find("from Pooling where username = ?",user.getUsername()).size() ;
		return p;
	}

}
